<template>
  <div v-loading="loading" class="followup_wrapper">
    <el-table
        :data="record"
        border
        style="width: 100%">

        <el-table-column
          prop="room_info.name"
          label="考场名称"
          width="120">
        </el-table-column>
        <el-table-column
          prop="point_name"
          label="考点名称"
          width="120">
        </el-table-column>
        <el-table-column
          prop="batch_info.name"
          label="批次名称"
          width="120">
        </el-table-column>
        <el-table-column
          prop="batch_info.date"
          label="日期"
          width="120">
        </el-table-column>
        <el-table-column
          prop="batch_info.start_time"
          label="开始时间"
          width="120">
        </el-table-column>
        <el-table-column
          prop="batch_info.end_time"
          label="结束时间"
          width="120">
        </el-table-column>
        <el-table-column
          label="操作">
          <template slot-scope="scope">
            <el-button  type="text" size="small" @click="downloadWord(scope.row)">信息确认表下载(WORD)</el-button>
            <el-button type="text" size="small" @click="downloadExcel(scope.row)">考生信息下载(EXCEL)</el-button>
          </template>
        </el-table-column>
      </el-table>
  </div>
</template>

<script>
import { kaochangRoomList} from '@/api/kaowu/kaochang'
import request from '@/utils/request'
export default {
  name: 'FollowUpRecord',
  props: ['id','rows'],
  data () {
    return {
      loading: false,
      disabled_state: false,
      listParams: {
        page: 1,
        page_size: 10,
        total: 0

      },
      pickerOptions: {
        selectableRange: (() => {
          return `00:00:00 - 23:59:59`
        })(),
        disabledDate(time){
          return time.getTime() < Date.now() - 8.64e7
        }
      },
      followUp: {
        status: '',
        desc: '',
      },
      record: [],
      total: 0,
      upload_url: '',
      headerObj: '',
      currentNav: '',
      user_id: ''
    }
  },
  created() {
    this.init()
  },
  methods: {
    downloadWord(item){
      let that = this;
      let $promise = request({url: '/kaowu/kaochang_info/downloadWord',method: 'post',data:{
          id:item.id,kkki_id:item.kkki_id
        }
      })
      $promise.then((res)=>{
        that.loading= false
        window.open(window.global.RequestHost + res.data.path)
        that.$message.success(res.message)
      })
    },
    downloadExcel(item){
      let that = this;
      let $promise = request({url: '/kaowu/kaochang_info/downloadExcel',method: 'post',data:{
          id:item.id,kkki_id:item.kkki_id
        }
      })
      $promise.then((res)=>{
        that.loading= false
        window.open(window.global.RequestHost + res.data.path)
        that.$message.success(res.message)
      })
    },

    init(){
      // this.userInfoDetails()
      this.roomList()
    },

    roomList(){
      this.loading = true
      kaochangRoomList({ 'id': this.id, 'page': this.listParams.page, 'pagesize': this.listParams.page_size })
        .then(res => {
          if (res.data.items.length > 0){
            this.record = res.data.items

            this.total = res.data.total
            this.listParams.total = res.data.total
            this.listParams.page = res.data.total_page
          }
          this.loading = false
        }).catch(() => {
          this.loading = false
        })
    }

  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-upload__text{
  height: 25px;
}
::v-deep .upload-demo{
  width: 100%;
}
::v-deep .el-upload{
  width: 100%;
}
::v-deep .el-upload-dragger{
  width: 100%;
}
::v-deep .el-col-12{
  height: 100vh;
}
::v-deep .el-form-item{
  margin-bottom: 20px;
}
::v-deep .el-form-item__label{
  font-size: 14px;
  color: #606266;
  font-weight:normal;
}
p{
  margin: 0;
  padding: 0;
  line-height: 24px;
}
.followup_wrapper{
  height: calc(100vh - 194px - 52px);
  overflow-y: auto;
  background: #fff;
  margin-top: 20px;
  padding:0 20px;
}
::v-deep .el-dialog__body{
  padding: 0;
}
.write{
  padding-top: 15px;
  border-right: 1px solid #ebeef5;
  .info{
    padding: 10px 30px;
    .el-select{
      width: 100%;
    }
    .customer{
      display: inline-block;
      padding: 1px 4px;
      height: 21px;
      border-radius: 2px;
      text-align: center;
      line-height: 21px;
      font-size: 12px;
      margin-right: 10px;
    }
    .add_tag{
      padding: 3px 10px;
      font-size: 12px;
    }
    .rule_tag{
      margin-left: 10px;
    }
  }
}
.history{
  .title{
    height: 50px;
    line-height: 50px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #ebeef5;
    .text{
      color: #333;
      font-weight: 600;
    }
    .total{
      color: #666;
      font-weight: 400;
      .sum{
        color: #6e86b1;
      }
    }
  }
  .history_list{
    padding: 0 20px;
    height: 600px;
    overflow-x: auto;
    &::-webkit-scrollbar{
      width: 8px;
      background: #fff;
    }
    &::-webkit-scrollbar-thumb{
      width: 8px;
      height: 30px;
      border-radius: 10px;
      background: #DEDEE4;
    }
    .history_item{
      display: flex;
      border-bottom: 1px dotted #dcdfe6;
      padding: 20px 0;
      width: 100%;
      .user{
        width: 40px;
        height:40px ;
        display: flex;
        border-radius: 50%;
        background: #4a88f7;
        justify-content: center;
        align-items: center;
        margin: 0 20px 20px 0;
        color: #fff;
      }
      .info{
        flex: 1;
        .followup{
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 16px;
          padding-top: 6px;
          &:hover .edit{
            display: block;
          }
          .text{
            color: #333;
            font-size: 15px;
            flex: 1;
            max-width: 200px;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space:nowrap;
            .color{
              color: #6e86b1;
              font-weight: 600;
            }
          }
          .text_right{
            display: flex;
          }
          .edit{
            display: none;
            margin-right: 15px;
            height: 14px;
            font-size: 14px;
            font-weight: 400;
            color: #0078ff;
            cursor: pointer;
          }
          .time{
            font-size: 14px;
            color: #999;
          }
        }
        .content{
          background-color: #f7f7f7;
          font-size: 14px;
          color: #333;
          padding: 16px;
          font-weight: 400;
          .img {
            display: inline-block;
            margin: 20px 10px 0px 0px;
          }
        }
      }
    }
  }
  .pagination{
    text-align: center;
    padding: 15px 20px 15px 0;
  }
}
.dialog_footer{
  width: 100%;
  display: inline-block;
  text-align: left;
  padding-left: 83px;
}
.dialog_footer2{
  width: 100%;
  display: inline-block;
  text-align: left;
}
</style>

